package bsc.ejb.metadata;

import bsc.ejb.entity.ActionPlan;
import bsc.ejb.entity.Settings;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author memozac
 */
@Entity
public class Colorimetry implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idColorimetry;

    @OneToMany
    private List<ActionPlan> actionPlans;

    @ManyToOne
    private Framework framework;

    @ManyToMany(targetEntity=Icon.class)
    @JoinTable(name="ColorimetryIcon",
    joinColumns=@JoinColumn(name="idColorimetry"),
    inverseJoinColumns=@JoinColumn(name="idIcon"))
    private Collection<Icon> icons;

    @ManyToMany(targetEntity=Settings.class)
    @JoinTable(name="ColorimetrySettings",
    joinColumns=@JoinColumn(name="idColorimetry"),
    inverseJoinColumns=@JoinColumn(name="idSettings"))
    private Collection<Settings> settings;

    @Column(columnDefinition="text")
    private String name;
    @Column(columnDefinition="text")
    private String description;
    private Integer priority;
    @Column(columnDefinition="text")
    private String color;

    public Collection<Settings> getSettings() {
        return settings;
    }

    public void setSettings(Collection<Settings> settings) {
        this.settings = settings;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getPriority() {
        return priority;
    }

    public void setPriority(Integer priority) {
        this.priority = priority;
    }

    public Framework getFramework() {
        return framework;
    }

    public void setFramework(Framework framework) {
        this.framework = framework;
    }

    public Collection<Icon> getIcons() {
        return icons;
    }

    public void setIcons(Collection<Icon> icons) {
        this.icons = icons;
    }

    public Long getIdColorimetry() {
        return idColorimetry;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idColorimetry != null ? idColorimetry.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Colorimetry)) {
            return false;
        }
        Colorimetry other = (Colorimetry) object;
        if ((this.idColorimetry == null && other.idColorimetry != null) || (this.idColorimetry != null && !this.idColorimetry.equals(other.idColorimetry))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.Colorimetry[id=" + idColorimetry + "]";
    }

    /**
     * @return the actionPlans
     */
    public List<ActionPlan> getActionPlans() {
        return actionPlans;
    }

    /**
     * @param actionPlans the actionPlans to set
     */
    public void setActionPlans(List<ActionPlan> actionPlans) {
        this.actionPlans = actionPlans;
    }
}//ends of class
